package com.ruoyi;

import net.coobird.thumbnailator.Thumbnails;
import org.apache.commons.io.FileUtils;

import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class Main {

    public static void main(String[] args) throws IOException {

////        Pattern pattern = Pattern.compile("(\\{[^\\)]*\\})");
//        String content = "设备名称{corp_ep_equip_info:equip_name}，当前数量为{corp_ep_equip_info:num}";
////        Matcher matcher = pattern.matcher(content);
////        while (matcher.find()){
////            System.out.println(matcher.group(0));
////        }
//        List<String> params = new ArrayList<>();
//        while(content.contains("}")){
//            int beginIndex = content.indexOf("{");
//            int endIndex = content.indexOf("}");
//            params.add(content.substring(beginIndex+1,endIndex));
//            content = content.substring(endIndex+1);
//        }
//        System.out.println();
        File pic = new File("/Users/gugang/test/4861678762341_.pic_hd.jpg");
//        FileUtils.(pic,new File("/Users/gugang/test/gg/test.jpg"));
        FileUtils.createParentDirectories(new File("/Users/gugang/test/gg/tt3.jpgs"));
        FileUtils.copyFile(pic,new File("/Users/gugang/test/gg/tt3.jpgs"));
        FileUtils.createParentDirectories(new File("/Users/gugang/test/gg/tt333.jpgs"));
        System.out.println(FileUtils.sizeOf(pic)/1024/1024);
        Thumbnails.of("/Users/gugang/test/4861678762341_.pic_hd.jpg").outputQuality(0.5f).scale(0.2d).toFile("/Users/gugang/test/1.jpg");
    }
}
